#include "bflb_mtimer.h"
#include "board.h"
#include "bflb_gpio.h"
#include "lcd_init.h"
#include "lcd.h"
#include "pic.h"


uint8_t i, j;
float t = 0;

void setup() {
  board_init();
  LCD_Init();
  // 在指定区域填充颜色
  LCD_Fill(0, 0, LCD_W, LCD_H, WHITE);
}

void loop() {
  // 点 显示直线
  for (i = 0; i < 20; i++)
  {
    LCD_DrawPoint(10 + i, 10, GREEN);
  }
  // 直线
  LCD_DrawLine(10, 20, 50, 20, BLUE);
  LCD_DrawLine(10, 20, 50, 50, BLUE);
  // 矩形
  LCD_DrawRectangle(120, 5, 200, 50, BLACK);
  // 圆
  Draw_Circle(250, 150, 150, RED);
  
  // 指定位置显示一个字符
  LCD_ShowChar(300, 40, 'A', BLUE, GREEN, 32, 0);
  // 显示整数
  LCD_ShowIntNum(350, 80, 5678, 9, BLUE, GREEN, 32);
  // 显示整数
  LCD_ShowIntNum(350, 120, 5678, 3, BLUE, GREEN, 32);
  // 显示小数
  LCD_ShowFloatNum1(400, 160, 3.1415926, 10, BLUE, GREEN, 16);
  
  LCD_ShowString(0, 40, "LCD_W:", RED, WHITE, 16, 0);
  LCD_ShowIntNum(48, 40, LCD_W, 3, RED, WHITE, 16);
  LCD_ShowString(80, 40, "LCD_H:", RED, WHITE, 16, 0);
  LCD_ShowIntNum(128, 40, LCD_H, 3, RED, WHITE, 16);
  LCD_ShowString(80, 40, "LCD_H:", RED, WHITE, 16, 0);
  LCD_ShowFloatNum1(128, 70, t, 4, RED, WHITE, 16);
  t += 0.11;
  for (i = 0; i < 8; i++)
  {
      LCD_ShowPicture(i * 40, 200, 40, 40, gImage_1);
  }
  bflb_mtimer_delay_ms(5000);

}
